#1 遍历python笔记文件
import os

except_foldername = ['.git', 'mytool']

def dirs_fun(file_path):
    dirlst1 = os.listdir(file_path)
    dirlst2 = []
    #print(dirlst1)
    for item1 in dirlst1:
        if '.py' in item1:
            continue
        elif 'chap' in item1:
            dirlst2.append(item1)

    for item2 in dirlst2:
        print(item2)
        dirlst3 =  os.listdir(file_path + '\\' + item2)
        for item3 in dirlst3:
            if '.py' in item3:
                print(item3)

dirs_fun(r'C:\zwProject\python\mypythonProject1\personal\daily code')